# class Solution:
#     def twoSum(self , numbers, target ) :
#         # write code here
#         list1=[0,0]
#         self.numbers=numbers
#         self.target=target
#         n=len(numbers)
#         for i in range(n):
#             for j in range(i+1,n):
#                 if numbers[i]+numbers[j]==target:
#                     list1[0],list1[1]=(i+1),(j+1)
#                     break
#         return list1
# numbers=[3,2,4]
# target=6
# s=Solution
# b=s.twoSum()
# a=b(numbers,target)
# print(a)
class Solution:
    def twoSum(self, numbers, target):
        # write code here
        res = []
        hash = dict()

        for i in range(len(numbers)):
            temp = target - numbers[i]
            if temp not in hash:
                hash[numbers[i]] = i
            else:
                res.append(hash[temp] + 1)
                res.append(i + 1)
                break
        return res

a= Solution()
b=a.twoSum([3,2,4,1],4)
print(b)

